﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Homework5._1四舍五入
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("请输入一个正数:");
            double Number = Convert.ToDouble(Console.ReadLine()); 
            while (Number<0)
            {
                Console.Write("输入错误，请重新输入一个正数：");
                Number = Convert.ToDouble(Console.ReadLine());
            }
            int num = (int)Number;
            int Rounding;
            if ((Number - num) >= 0.5)
            {
                Rounding = num + 1;
            }
            else
            {
                Rounding = num;
            }
            Console.WriteLine($"该正数四舍五入后的结果为{Rounding}");
            Console.ReadKey();
            }
    }
}
